Make GtkTextAttributes private
authorMatthias Clasen <mclasen@redhat.com>
Thu, 27 Oct 2016 17:39:01 +0000 (13:39 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 1 Nov 2016 17:58:10 +0000 (13:58 -0400)
This is a problematic struct, and giving direct access to it
has kept us from making improvements to GtkTextView. Drop it
from the public API, together with the auxiliary APIs. If
it turns out that this functionality is needed, we should add
individual getters.

gtk/Makefile.am
gtk/a11y/gtktextviewaccessible.c
gtk/gtktextiter.c
gtk/gtktextview.c
gtk/gtktextview.h
gtk/gtktextviewprivate.h

index 8e17336e2533c65b18fe82ac0091e59d336e2abe..8078bcb68a214f328be14e64224d331193d46434 100644 (file)
@@ -302,7 +302,6 @@ gtk_public_h_sources =              \
        gtkstyleprovider.h      \
        gtkswitch.h             \
        gtktestutils.h          \
-       gtktextattributes.h     \
        gtktextbuffer.h         \
        gtktextbufferrichtext.h \
        gtktextchild.h          \
@@ -348,11 +347,6 @@ gtk_unix_print_public_h_sources =  \
        gtkunixprint.h
 endif
 
-# Installed header files without compatibility guarantees
-# that are not included in gtk/gtk.h
-gtk_semi_private_h_sources = \
-       gtktextlayout.h
-
 gtk_private_type_h_sources =   \
        gtkcsstypesprivate.h    \
        gtktexthandleprivate.h
@@ -553,12 +547,14 @@ gtk_private_h_sources =           \
        gtkstylepropertyprivate.h \
        gtkstyleproviderprivate.h \
        gtktextattributesprivate.h \
+       gtktextattributes.h     \
        gtktextbtree.h          \
        gtktextbufferprivate.h \
        gtktextbufferserialize.h \
        gtktextchildprivate.h   \
        gtktexthandleprivate.h  \
        gtktextiterprivate.h    \
+       gtktextlayout.h         \
        gtktextmarkprivate.h    \
        gtktextsegment.h        \
        gtktexttagprivate.h     \
@@ -1364,7 +1360,7 @@ gtktestutils.c: gtktypefuncs.c
 lib_LTLIBRARIES = libgtk-4.la
 
 gtkincludedir = $(includedir)/gtk-4.0/gtk
-gtkinclude_HEADERS = $(gtk_public_h_sources) $(gtk_semi_private_h_sources) $(gtk_built_public_sources) gtkversion.h
+gtkinclude_HEADERS = $(gtk_public_h_sources) $(gtk_built_public_sources) gtkversion.h
 
 a11yincludedir = $(includedir)/gtk-4.0/gtk/a11y
 a11yinclude_HEADERS= $(a11y_h_sources)
index 7adcc62d220b7fa485d81755f40ca0491ecbd7cc..9ff6e141b4439c793128ccab79ec44aa93f5d15d 100644 (file)
@@ -30,6 +30,7 @@
 #include <gtk/gtk.h>
 #include "gtktextviewaccessibleprivate.h"
 #include "gtktextbufferprivate.h"
+#include "gtktextviewprivate.h"
 #include "gtk/gtkwidgetprivate.h"
 
 struct _GtkTextViewAccessiblePrivate
index 3e13d801ec3e532ab38001e885a6dd246e34d827..e02bf8985fd0b723267897bea6235aee6acc50e3 100644 (file)
@@ -1458,6 +1458,32 @@ gtk_text_iter_can_insert (const GtkTextIter *iter,
     }
 }
 
+gboolean
+gtk_text_iter_get_attributes (const GtkTextIter  *iter,
+                              GtkTextAttributes  *values)
+{
+  GtkTextTag** tags;
+  gint tag_count = 0;
+
+  /* Get the tags at this spot */
+  tags = _gtk_text_btree_get_tags (iter, &tag_count);
+
+  /* No tags, use default style */
+  if (tags == NULL || tag_count == 0)
+    {
+      g_free (tags);
+
+      return FALSE;
+    }
+
+  _gtk_text_attributes_fill_from_tags (values,
+                                       tags,
+                                       tag_count);
+
+  g_free (tags);
+
+  return TRUE;
+}
 
 /**
  * gtk_text_iter_get_language:
@@ -1743,49 +1769,6 @@ gtk_text_iter_get_bytes_in_line (const GtkTextIter   *iter)
   return count;
 }
 
-/**
- * gtk_text_iter_get_attributes:
- * @iter: an iterator
- * @values: (out): a #GtkTextAttributes to be filled in
- *
- * Computes the effect of any tags applied to this spot in the
- * text. The @values parameter should be initialized to the default
- * settings you wish to use if no tags are in effect. You’d typically
- * obtain the defaults from gtk_text_view_get_default_attributes().
- *
- * gtk_text_iter_get_attributes() will modify @values, applying the
- * effects of any tags present at @iter. If any tags affected @values,
- * the function returns %TRUE.
- *
- * Returns: %TRUE if @values was modified
- **/
-gboolean
-gtk_text_iter_get_attributes (const GtkTextIter  *iter,
-                              GtkTextAttributes  *values)
-{
-  GtkTextTag** tags;
-  gint tag_count = 0;
-
-  /* Get the tags at this spot */
-  tags = _gtk_text_btree_get_tags (iter, &tag_count);
-
-  /* No tags, use default style */
-  if (tags == NULL || tag_count == 0)
-    {
-      g_free (tags);
-
-      return FALSE;
-    }
-
-  _gtk_text_attributes_fill_from_tags (values,
-                                       tags,
-                                       tag_count);
-
-  g_free (tags);
-
-  return TRUE;
-}
-
 /*
  * Increments/decrements
  */
index f0d8cb3bc09ad59c7126709d2d6c302abf8758fa..75b50b95cb03c4a1b5103672738a80e79529bd3e 100644 (file)
@@ -7928,21 +7928,6 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
     }
 }
 
-/**
- * gtk_text_view_get_default_attributes:
- * @text_view: a #GtkTextView
- * 
- * Obtains a copy of the default text attributes. These are the
- * attributes used for text unless a tag overrides them.
- * You’d typically pass the default attributes in to
- * gtk_text_iter_get_attributes() in order to get the
- * attributes in effect at a given text position.
- *
- * The return value is a copy owned by the caller of this function,
- * and should be freed with gtk_text_attributes_unref().
- * 
- * Returns: a new #GtkTextAttributes
- **/
 GtkTextAttributes*
 gtk_text_view_get_default_attributes (GtkTextView *text_view)
 {
index cf5794487344b3a602c4c07b9dee95bb57acc9c1..7d1f9be5b0bcdccbb97c92d234f9e7f362090d67 100644 (file)
@@ -431,10 +431,6 @@ void             gtk_text_view_set_tabs               (GtkTextView      *text_vi
 GDK_AVAILABLE_IN_ALL
 PangoTabArray*   gtk_text_view_get_tabs               (GtkTextView      *text_view);
 
-/* note that the return value of this changes with the theme */
-GDK_AVAILABLE_IN_ALL
-GtkTextAttributes* gtk_text_view_get_default_attributes (GtkTextView    *text_view);
-
 GDK_AVAILABLE_IN_3_6
 void             gtk_text_view_set_input_purpose      (GtkTextView      *text_view,
                                                        GtkInputPurpose   purpose);
index 9eddfd81c0ea0143c1bf3801ac952cfb0efb0133..1f23cc45c969e959c09ba02fffeedc6c0786a572 100644 (file)
@@ -20,6 +20,7 @@
 #define __GTK_TEXT_VIEW_PRIVATE_H__
 
 #include "gtktextview.h"
+#include "gtktextattributes.h"
 #include "gtkcssnodeprivate.h"
 
 G_BEGIN_DECLS
@@ -27,6 +28,9 @@ G_BEGIN_DECLS
 GtkCssNode *    gtk_text_view_get_text_node             (GtkTextView *text_view);
 GtkCssNode *    gtk_text_view_get_selection_node        (GtkTextView *text_view);
 
+GtkTextAttributes * gtk_text_view_get_default_attributes (GtkTextView *text_view);
+
+
 G_END_DECLS
 
 #endif /* __GTK_TEXT_VIEW_PRIVATE_H__ */